]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Update message indicator on queue changes
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 21 Feb 2015 08:59:24 +0000 (09:59 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 21 Feb 2015 09:32:08 +0000 (10:32 +0100)
The message indicator conveys that the message list contains unseen
messages that will not be shown as banner. So its visibility depends
on two factors: the number of unseen messages, and the number of
messages waiting in the queue to be shown as banner. As we currently
only update the visibility on changes to the former, the indicator is
not always accurate - for instance sources notify count changes before
passing on a notification to the message tray for display.
To fix, add a signal to the message tray to notify when the queue
changes and use it to update the indicator's visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=744880

js/ui/dateMenu.js
js/ui/messageTray.js

index 55b360b3166b112032ddbe4f675840ce436b6d9e..a36da317bf4166045e8d5d942f2962e8ada5f04f 100644 (file)
@@ -231,6 +231,7 @@ const MessagesIndicator = new Lang.Class({
 
         Main.messageTray.connect('source-added', Lang.bind(this, this._onSourceAdded));
         Main.messageTray.connect('source-removed', Lang.bind(this, this._onSourceRemoved));
+        Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
 
         let sources = Main.messageTray.getSources();
         sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
index 345dede34d42a6f867bdfd6ff624e30cdef335bd..c66e7b9d29205b707cdb0c43d604c27f9d1aec25 100644 (file)
@@ -1662,8 +1662,10 @@ const MessageTray = new Lang.Class({
         }
 
         let index = this._notificationQueue.indexOf(notification);
-        if (index != -1)
+        if (index != -1) {
             this._notificationQueue.splice(index, 1);
+            this.emit('queue-changed');
+        }
     },
 
     _onNotify: function(source, notification) {
@@ -1686,6 +1688,7 @@ const MessageTray = new Lang.Class({
                 this._notificationQueue.sort(function(notification1, notification2) {
                     return (notification2.urgency - notification1.urgency);
                 });
+                this.emit('queue-changed');
             }
         }
         this._updateState();
@@ -1806,10 +1809,15 @@ const MessageTray = new Lang.Class({
         this._updatingState = true;
 
         // Filter out acknowledged notifications.
+        let changed = false;
         this._notificationQueue = this._notificationQueue.filter(function(n) {
+            changed = changed || n.acknowledged;
             return !n.acknowledged;
         });
 
+        if (changed)
+            this.emit('queue-changed');
+
         let hasNotifications = Main.sessionMode.hasNotifications;
 
         if (this._notificationState == State.HIDDEN) {
@@ -1881,6 +1889,7 @@ const MessageTray = new Lang.Class({
 
     _showNotification: function() {
         this._notification = this._notificationQueue.shift();
+        this.emit('queue-changed');
 
         this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
         if (!this._userActiveWhileNotificationShown) {